const fetchRoleList = (size) => {
  let list = [];
  for (let index = 0; index < size; index++) {
    list = list.concat({
      "id|+1": index + 1,
      name: "@cname",
      "remark|1": "@sentence",
      createTime: "@datetime",
      rolePermission: "1,2,2-1,2-2",
    });
    console.log(list, "===list====");
  }
  return list;
};

export default [
  {
    url: "/api/role/add",
    method: "post",
    response: () => {
      return {
        code: 200,
        data: {
          "id|+1": "@id",
          name: "@cname",
          "remark|1": "@sentence",
          createTime: "@datetime",
        },
      };
    },
  },
  {
    url: "/api/role/getPageList",
    method: "get",
    response: (options) => {
      const urlParams = new URLSearchParams(options.url.split("?")[1] || "");
      const list = fetchRoleList(urlParams.get("pageSize"));
      console.log(list, urlParams, "urlParams");
      return {
        code: 200,
        total: 12,
        data: list,
      };
    },
  },
  {
    url: "/api/role/getAllRoleList",
    method: "get",
    response: (options) => {
      const list = fetchRoleList(12);
      return {
        code: 200,
        total: 12,
        data: list,
      };
    },
  },
];
